package com.example.mattrigle;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class UDataStorage {
	
	public static Boolean setData(Context con, String variable, String data)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    prefs.edit().putString(variable, data).commit();
	    return true;
	}
	
	public static Boolean setStrData(Context con, String variable, String data)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    prefs.edit().putString(variable, data).commit();
	    return true;
	}
	
	public static Boolean setIntData(Context con, String variable, int data)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    prefs.edit().putInt(variable, data).commit();
	    return true;
	}
	
	public static Boolean setBoolData(Context con, String variable, Boolean data)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    prefs.edit().putBoolean(variable, data).commit();
	    return true;
	}
	
	public static String getStrData(Context con, String variable, String defaultValue)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    String data = prefs.getString(variable, defaultValue);
	    return data;
	}
	
	public static Boolean getBoolData(Context con, String variable, Boolean defaultValue)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    Boolean data = prefs.getBoolean(variable, defaultValue);
	    return data;
	}
	
	public static int getIntData(Context con, String variable, int defaultValue)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    int data = prefs.getInt(variable, defaultValue);
	    return data;
	}
	
	public static String getData(Context con, String variable, String defaultValue)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    String data = prefs.getString(variable, defaultValue);
	    return data;
	}
	
}
